# 198. 打家劫舍
# https://leetcode-cn.com/problems/house-robber/



class Solution:
    def rob(self, nums):
        last, now = 0, 0
        for n in nums:
            last, now = now, max(now, last + n)
        return now

print(Solution().rob([2,7,9,3,1]))